#include<iostream>
#include<unordered_map>
#include<vector>
#include<string>
using namespace std;
unordered_map<string,int>um;
vector<int>sz;
vector<string>s;
vector<int>m;
void fun(int front,int rear){
    if(front>=rear)return;
    int i=front,j=rear,k=m[front];
    string ch=s[i];
    while(i<j){
        while(i<j&&m[j]<k)
            j--;
        if(i<j){
            m[i]=m[j];
            s[i++]=s[j];
        }while(i<j&&m[i]>=k)
            i++;
        if(i<j){
            m[j]=m[i];
            s[j--]=s[i];
        }
    }
    m[i]=k;
    s[i]=ch;
    fun(front,i-1);
    fun(i+1,rear);
}
int main(){
    string str;
    char ch;
    while(scanf("%c",&ch))
        if(ch=='\n')break;
        else if(str.length()==0){
            sz.push_back(ch);
            str+=ch;
        }else if(str.length()>0){
            sz[str.length()]=sz[str.length()-1]+ch;
            str+=ch;
        }
    for(int i=0;i<str.length();i++)
        for(int j=i;j<str.length();j++){
            if(i>0)um[str.substr(i,j-1+1)]=sz[j]-sz[i-1];
            else um[str.substr(i,j-i+1)]=sz[j];
            // cout<<str.substr(i,j-i+1)<<endl;
        }
    for(auto val:um){
        s.push_back(val.first);
        m.push_back(val.second);
    }
    // for(int i=0;i<s.size();i++)
    //     cout<<m[i]<<"\t"<<s[i]<<endl;
    // cout<<endl;
    fun(0,s.size()-1);
    int k;
    cin>>k;
    // for(int i=0;i<s.size();i++)
    //     cout<<m[i]<<"\t"<<s[i]<<endl;
    cout<<s[k-1]<<endl;
        // cout<<val.first<<"\t"<<val.second<<endl;
    return 0;   
}